package com.spring.crud.entities;

import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.format.annotation.NumberFormat;

import java.util.Date;

public class Employee {
    private Integer id;

    private String lastName;
    private String email;
    private Integer gender;  //1 male ,0 female
    private Department department;

    /**
     * 数据格式化
     * 1.加<mvc:annotation-driven></mvc:annotation-driven>
     * 2.添加 @DateTimeFormat或者@NumberFormat等
     */
    @DateTimeFormat(pattern = "yyyy-MM-dd")        //springmvc要知道把什么格式转化为date
    private Date birth;
    @NumberFormat(pattern = "#,####.##")
    private Float salary;

    public Date getBirth() {
        return birth;
    }

    public void setBirth(Date birth) {
        this.birth = birth;
    }

    public Float getSalary() {
        return salary;
    }

    public void setSalary(Float salary) {
        this.salary = salary;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getLastName() {
        return lastName;
    }

    public void setLastName(String lastName) {
        this.lastName = lastName;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public Integer getGender() {
        return gender;
    }

    public void setGender(Integer gender) {
        this.gender = gender;
    }

    public Department getDepartment() {
        return department;
    }

    public void setDepartment(Department department) {
        this.department = department;
    }
    public Employee(){

    }
    public Employee(Integer id,String lastName,String email,Integer gender,Department department){
        this.id=id;
        this.lastName=lastName;
        this.email=email;
        this.gender=gender;
        this.department=department;
    }

    @Override
    public String toString() {
        return "Employee{" +
                "id=" + id +
                ", lastName='" + lastName + '\'' +
                ", email='" + email + '\'' +
                ", gender=" + gender +
                ", department=" + department +
                ", birth=" + birth +
                ", salary=" + salary +
                '}';
    }
}
